<?php
namespace Mob \ Model;

use Think \ Model;
use Think \ Hook;
/**招聘签到模型
 * Class InfoModel
 */

require_once ('./Application/Mob/Common/function.php');

class JobsStepModel extends Model {

	  protected $tableName = 'jobs_step_record';

	public function creatorStep($jobsserialno,$lastStep,$currentStep,$sponsorUid,$actlongitude,$actlatitude,$startDate,$endDate)
	{
     $data['jobsserialno']=$jobsserialno;
     $data['currentStep']=$currentStep;
     $data['stepType']=1;
     $data['sponsorUid']=$sponsorUid;
     $data['actlongitude']=$actlongitude;
     $data['actlatitude']=$actlatitude;
     $data['createTime']=time();
     $data['status']=1;
     $data['startDate']=$startDate;
     $data['endDate']=$endDate;
     $data['lastStep']=$lastStep;
     $data['stepSerialno']=getSerialno();
     if($this->add($data))
     {
     return $data['stepSerialno'];
     }

	}

	public function updateStepSignNum($jobsserialno,$stepSerialno)
	{
	 $where = array('jobsserialno'=>$jobsserialno,'stepSerialno'=>$stepSerialno,'status'=>1);
	 $this->where($where)->setInc('signCount');

	}
	public function get_SignStepDetail($jobsserialno,$currentStep)
	{
	 $where = array('jobsserialno'=>$jobsserialno,'currentStep'=>$currentStep,'status'=>1);
	 $SignStepDetail = $this->where($where)->field('jobsserialno,currentStep,stepType,sponsorUid,actlongitude,actlatitude,createTime,startDate,signCount,stepSerialno')->order(' createTime desc')->select();
     return $SignStepDetail;

	}
	public function get_SignStepDetails($jobsserialno,$stepSerialno)
	{
    $where = array('jobsserialno'=>$jobsserialno,'stepSerialno'=>$stepSerialno,'status'=>1);
   $StepDetails =  $this->where($where)->field('jobsserialno,currentStep,stepType,sponsorUid,actlongitude,actlatitude,createTime,startDate,signCount,stepSerialno')->find();
   return $StepDetails;

	}

















}